package com.woniuxy.stage3demo.controller.lyl;

import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
@RequestMapping("/mail")
@RestController
public class MailControllerDemo {
    @Resource
    private JavaMailSender mailSender;
    @RequestMapping("/send1")
    public void sendSimpleMail(String title,String context){
        SimpleMailMessage message = new SimpleMailMessage();
        message.setFrom("xiaomiami@vip.qq.com");
        message.setTo("1851971594@qq.com");
        message.setSubject(title);
        message.setText(context);
        mailSender.send(message);
    }

}
